package cn.zjp.controller;

import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.zjp.domain.Person;
import cn.zjp.service.IPersonService;


@Controller
@RequestMapping(value="/person")
public class PersonController {
	@Resource(name="personService")
	private IPersonService ps;
	
	@RequestMapping(value="/findPersonById")
	public String findPersonById(String id,Map<String, Object> map){
		Person person = ps.findPersonById(id);
		System.out.println(person);
		map.put("person", person);
		return "showPerson";
	}
	
	@RequestMapping(value="/save")
	public String savePerson(Person p,Model model){
		ps.savePerson(p);
		model.addAttribute("person", p);
		return "a/a";
	}
}
